<template>
	<view>
		<view class="list-item" v-for="item,index in dataList" @tap="navToDetail" :key="item.index" :data-key="item.DATAKEY" :data-stage="item.PROJ_STAGE" :data-proId="item.PROJ_ID">
			<view class="item-name">
				<text class="left-text-top">{{item.NAME}}</text>
			</view>
			<view class="item-top">
				<view class="setion-top">
					<view class="left-text-bot">
						<uni-rate :value="item.star" :size="18" :readonly="true" />
					</view>
					<view class="right-text-bot">{{item.createTime}}</view>
				</view>
				<view class="setion-bottom">
					<view class="right-text-top">{{item.proStep}}</view>
					<view class="see-setion">
						<view class="right-box botsty" @click.stop="showTostPage" :data-key="item.DATAKEY" :data-proId="item.PROJ_ID" :data-name="item.NAME">
							<image src="../../../static/images/icon_Instructions.png" mode=""></image>	
							<view class="text-sty">批示信息</view>
							<view v-if="item.MESSAGEREADED==1"  class="red-point"></view>
						</view>
						<view class="right-box topsty" @click.stop="navToPage" v-if="currPage!='busProjManage'" :data-key="item.DATAKEY" :data-proId="item.PROJ_ID">
							<image src="../../../static/images/icon_report.png" mode=""></image>
							<view class="text-sty">报送信息</view>
						</view>
					</view>
				</view>
			</view>
			<view class="setion-update">
				<view class="right-text"></view>
				<view class="right-box botsty" @click.stop="navToUpdate" :data-key="item.DATAKEY" :data-proId="item.PROJ_ID" :data-name="item.NAME">
					<image src="../../../static/images/icon_Instructions.png" mode=""></image>	
					<view class="text-sty">更新内容</view>
					<view v-if="item.MESSAGEREADED==1"  class="red-point"></view>
				</view>
			</view>
			<view class="item-bot">
				<view class="item-main">
					{{item.NEXT_WORK || '-'}}
				</view>
				<view class="tag-box">
					<text class="tag-sty" v-if="item.followPerson">{{item.followPerson }}</text>
					<text class="tag-sty">{{item.proState}}</text>
					<text class="tag-sty" v-if="item.placeUsingType">{{item.placeUsingType}}</text>
					<text class="tag-sty" v-if="item.EXPECT_INVEST">{{item.EXPECT_INVEST}}(亿元)</text>
					<text class="tag-sty" v-if="item.SITE_AREA">{{item.SITE_AREA}}(亩)</text>
				</view>
			</view>
			<view class="item-image-box">
				<image src="../../../static/images/icon_banjie.png" mode="widthFix" v-if="item.PROJ_STATUS === '4'"></image>
				<image src="../../../static/images/icon_zanhuan.png" mode="widthFix" v-if=" item.PROJ_STATUS != '4' && item.ISREPRIEE === '1'"></image>
			</view>
			<view class="chkbox" @click.stop="handleChangeChkBox(index)" v-if="showCheckBox">
				<view class="inner" v-if=" index === actIndex">
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				code: '',
				isChecked: false,
				actIndex:null
			}
		},
		props: {
			dataList: {
				type: Array,
				default: []
			},
			dic: {
				type: Object,
				default: {}
			},
			showCheckBox: {
				type: Boolean,
				default: false
			},
			currPage:{
				type:String,
				default:'busProjManage'
			}
		},
		methods: {
			
			navToDetail(e){
			
				const data = e.currentTarget.dataset
				console.log('data',data)
				const code = data.proid ? data.proid : data.key
				uni.navigateTo({
					url: `/pages/index/detail/detail?code=${code}&project=${data.stage}`
				})
			},
			handleChangeChkBox(index){
				
				this.actIndex = index;
				this.$emit('getIndex',{index:index})
			},
			reset(){
				this.actIndex = null;
			},
			navToPage(e) {
				console.log('e',e)
				const data = e.currentTarget.dataset
				uni.navigateTo({
					url: `/pages/submitReport/detail?dataKey=${data.key}&projId=${data.proid}`
				})
			},
			navToUpdate(e){
				const data = e.currentTarget.dataset
				uni.navigateTo({
					url: `/pages/updateContent/updateContent?dataKey=${data.key}&projId=${data.key}&projectName=${data.name}`
				})
				
			},
			showTostPage(e) {
				console.log('e',e)
				const data = e.currentTarget.dataset
				uni.navigateTo({
					url: `/pages/readInformation/readInformation?dataKey=${data.key}&projId=${data.key}&projectName=${data.name}`
				})
			},
		}
	}
</script>

<style lang="scss" scoped>
	.list-item {
		background-color: #FFFFFF;
		margin: 20rpx 30rpx 0 30rpx;
		padding: 20rpx 24rpx 40rpx 24rpx;
		border-radius: 20rpx;
		position: relative;
		.item-name{
			width: 100%;
			font-size: 30rpx;
			font-weight: 600;
			color: #414a5d;
		}
		.item-top {
			.setion-top{
				width: 100%;
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
				.left-text-bot {
					margin: 14rpx 0;
				}
				.right-text-bot {
					// margin-top: 22rpx;
					font-size: 28rpx;
					font-weight: normal;
					color: #999999;
				}
			}
			.setion-bottom{
				width: 100%;
				display: flex;
				flex-direction: row;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 14rpx;
				.right-text-top {
					width: 120rpx;
					height: 36rpx;
					line-height: 36rpx;
					text-align: center;
					background-color: #00ac0c;
					border-radius: 4rpx;
					font-size: 24rpx;
					font-weight: normal;
					color: #FFFFFF;
				}
				.see-setion{
					.right-box{
						width: 140rpx;
						height: 36rpx;
						border-radius: 6rpx;
						display: flex;
						align-items: center;
						position: relative;
						.red-point{
							position: absolute;
							top: -10rpx;
							right: -6rpx;
							width: 20rpx;
							height: 20rpx;
							border-radius: 50%;
							background-color: red;
						}
						.text-sty{
							line-height: 36rpx;
							font-family: AlibabaPuHuiTi-Regular;
							font-size: 24rpx;
							color: #ffffff;
						}
						image{
							width: 20rpx;
							height: 25rpx;
							margin: 0 7rpx;
						}
					}
				}
				
				.botsty{
					// margin-top: 10rpx;
					background-color: #00c60e;
				}
			}
		}
		.topsty{
			background-color: #f39025;
		}
		.right-box{
			float: right;
			display: flex;
			align-items: center;
			border-radius: 6rpx;
			image{
				width: 20rpx;
				height: 25rpx;
				margin: 0 7rpx;
			}
			.text-sty{
				line-height: 36rpx;
				font-family: AlibabaPuHuiTi-Regular;
				font-size: 24rpx;
				color: #ffffff;
			}
		}
		.setion-update{
			width: 100%;
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			margin: 10rpx 0;
			.right-text-top {
				width: 120rpx;
				height: 36rpx;
				line-height: 36rpx;
				text-align: center;
				background-color: #00ac0c;
				border-radius: 4rpx;
				font-size: 24rpx;
				font-weight: normal;
				color: #FFFFFF;
			}
			.right-box{
				width: 140rpx;
				height: 36rpx;
				border-radius: 6rpx;
				display: flex;
				align-items: center;
				position: relative;
				.red-point{
					position: absolute;
					top: -10rpx;
					right: -6rpx;
					width: 20rpx;
					height: 20rpx;
					border-radius: 50%;
					background-color: red;
				}
				.text-sty{
					line-height: 36rpx;
					font-family: AlibabaPuHuiTi-Regular;
					font-size: 24rpx;
					color: #ffffff;
				}
				image{
					width: 20rpx;
					height: 25rpx;
					margin: 0 7rpx;
				}
			}
			.botsty{
				// margin-top: 10rpx;
				background-color: #4399FC;
			}
			.botstytwo{
				background-color: #0099cc;
			}
		}
		.item-bot {
			.item-main {
				font-family: AlibabaPuHuiTi-Regular;
				font-size: 28rpx;
				font-weight: normal;
				line-height: 34rpx;
				letter-spacing: 0px;
				color: #999999;
				text-overflow: ellipsis;
				overflow: hidden;
				display: -webkit-box;
				-webkit-line-clamp: 2;
				-webkit-box-orient: vertical;
				height: 80rpx;
			}

			.tag-box {
				margin-top: 22rpx;

				.tag-sty {
					margin-right: 10rpx;
					padding: 6rpx 8rpx;
					font-size: 24rpx;
					border-radius: 4rpx;
					color: #999999;
					background-color: #e6e6e6;
				}
			}
		}

		.item-image-box {
			position: absolute;
			bottom: 18rpx;
			right: 18rpx;
			display: flex;
			image {
				width: 108rpx;
				height: 108rpx;
			}
		}
		
		.chkbox {
			width: 20px;
			height: 20px;
			border: solid 3px #0099cc;
			position: absolute;
			left: 0;
			bottom: 0;
			border-radius: 6px;
			display: flex;
			align-items: center;
			justify-content: center;
		
			.inner {
				width: 10px;
				height: 10px;
				border-radius: 4px;
				background-color: #0089b6;
			}
		}
	}
</style>
